package com.codejiwei.core.rdd

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object Spark_RDD_Create {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setMaster("local[2]").setAppName("RDDCreate")
    val sc = new SparkContext(conf)

    val ints: Seq[Int] = Seq(1, 2, 3, 4)
    val ints1: List[Int] = List(1, 2, 3, 4, 5)

    val rdd: RDD[Int] = sc.parallelize(ints)
    val rdd1: RDD[Int] = sc.makeRDD(ints1)

    rdd.collect().foreach(println)
    rdd1.collect().foreach(println)

    sc.stop()
  }
}
